home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2003 November / PCWK1103B.iso / DesignCAD 3D Max PLUS trial 30 / DATA1.CAB / Example_Files / Sample_Macros / Lines&Layers.d3m < prev    next >
Encoding:
Text File  |  2003-09-29  |  845 b   |  36 lines

  1. ' This simple macro outputs the layer name of each layer a line is on
  2. ' and the endpoints of that line to an ASCII text file.
  3. '
  4. ' Dimension Array to hold Point Values
  5.   Dim ax(4), ay(4), az(4)
  6. ' Open Output file
  7.   Open "o", 1, "*\airfoil.dat"
  8. ' Loop through entire Drawing
  9.   for a = 1 to Sys(9)
  10.     ' Check to see if entities are lines
  11.       getattr a, type
  12.     if type = 1 then
  13.     ' Select Current Entity
  14.         Entity a
  15.     ' Get Layer of Entity
  16.         LayNum = Sys(93)
  17.     ' Switch to that Layer
  18.         Sys(3) = LayNum
  19.     ' Get Current Layer Name
  20.         LayName$ = Sys$(93)
  21.     ' Loop for points set
  22.         for b = 1 to Sys(1)
  23.             ' Get Point Values
  24.               pointval ax(b) ay(b) az(b) b
  25.             ' Construct Output String
  26.                 test$ = LayName$,"  ",ax(b),"  ",ay(b),"  ",az(b)
  27.               print #1, test$
  28.         next b
  29.     endif
  30.   next a
  31. ' Close the File
  32.     Close #1
  33. ' Done
  34. End
  35.  
  36.